			
				<div id="alertMessage" class="message"></div>
			<div id="content">
                <div class="inner">
					<div class="topcolumn">
						<div class="logo"></div>
                            <ul  id="shortcut">
                                <li> <a href="#" title="Back To home"> <img src="<?php echo base_url();?>public/admin/img/icon/shortcut/home.png" alt="home"/><strong>Home</strong> </a> </li>
                                <li> <a href="#" title="Website Graph"> <img src="<?php echo base_url();?>public/admin/img/icon/shortcut/graph.png" alt="graph"/><strong>Graph</strong> </a> </li>
                                <li> <a href="#" title="Setting" > <img src="<?php echo base_url();?>public/admin/img/icon/shortcut/setting.png" alt="setting" /><strong>Setting</strong></a> </li> 
                                <li> <a href="#" title="Messages"> <img src="<?php echo base_url();?>public/admin/img/icon/shortcut/mail.png" alt="messages" /><strong>Message</strong></a><div class="notification" >10</div></li>
                            </ul>
					</div> <!-- End .topcolumn -->
                    <div class="clear"></div>           


                        <div class="onecolumn" >
	                        <div class="header">
	                        <span ><span class="ico gray pictures_folder"></span>GALLERY MANAGER</span>
		                        <div id="buttom_top">
		                            <ul class="uibutton-group">
		                                <li><a class="uibutton icon add "  href="<?php echo admin_url('add-new-gallery-cate'); ?>"  >New Album</a></li>
		                                <li>
		                                	<div id="uploadButtondisable"></div>
		                                	<a  class="uibutton disable icon secure "   id="uploadAlbum">upload Pic to Album</a>
		                                </li>
		                            </ul>
		                        </div> <!-- End #buttom_top -->
                        </div><!-- End header -->	
                         <div class="clear"></div>     
                        <div class="content" >

                        <div id="albumsList" >
	                        <div class="load_page" style="padding:0">
	                        	<?php if(count($gallery_category[0])>0){?>
	                        	<?php foreach ($gallery_category as $album){
	                        			//get all photos in specific album
	                        			$photos	=	$this->gallery_model->get_photos_in_album($album->id);
	                        			if(count($photos[0])>0) {
	                        	?>
	                        	
                            	<div class="album load" id="<?php echo $album->id;?>">
                            		<span style="display: none;"><?php echo $album->name;?></span>
                                	<div class="preview">
                                		<?php if(count($photos[0])>0){
                                				foreach ($photos as $key => $image){
                                					if($key <=2){
                                		?>
                                        		<img width="130" height="90" id="photo<?php echo $key + 1;?>" class="stackphotos" src="<?php echo base_url().$image->thumb_url;?>" alt="Thumbnail" />
                                        <?php }}}?>
                                    	<div style="clear:both"></div>
                                    </div>
                                    <div class="title"><?php echo $album->name?></div>
                                    <div class="title"><span style="color: green;"><?php echo $album->created_date;?></span></div>
                                    <div class="stats">Images: <span class="picCount"><?php echo count($photos);?></span></div>
                                    <div class="clear"></div>
                                </div> <!-- End .album .load -->
                                <?php 		}else{ 	?>
                                				<div class="album load" id="<?php echo $album->id;?>">
				                                	<div class="preview">
				                                        <img width="130" height="90" id="p1" class="stackphotos" src="<?php echo base_url()."public/admin/img/no_image.gif";?>" alt="Thumbnail" />
				                                    	<div style="clear:both"></div>
				                                    </div>
				                                    <div class="title nameAlbum"><?php echo $album->name?></div>
				                                    <div class="title"><span style="color: green;"><?php echo $album->created_date;?></span></div>
				                                    <div class="stats">Images: <span class="picCount">0</span></div>
				                                    <div class="clear"></div>
				                                </div> <!-- End .album .load -->
                                <?php 
                                			}// End if(count($photo[0]))
	                        			}// End foreach
									}// End if(count)
                                ?>

	                        </div> <!-- End .load_page -->
                        </div> <!-- End #albumList -->
                        
                        <div class="screen-msg">
                        	<span class="icon"><img src="<?php echo base_url();?>public/admin/img/icon/dialog.png" alt="dialog"/></span>Click album to more any images.
                        </div>
                        
                        <div class="albumImagePreview">
                              <div class="album_edit" style="display:none">
	                              <form name="Save_form"  id="Save_form" action="<?php echo admin_url('edit-gallery');?>" method="post">
		                              <h1>Edit  Album</h1>
		                              <!--<div class="picPreview EditPreview">
		                              	  Show thumb edit 
		                              </div>-->
		                              <div class="clear"></div>
		                              <div class="hr"></div>
	                              	  <div class="hiddenInfo">
	                              	  	<!-- Show input hidden here to send editing album's ID :) -->	
	                                  </div>
	                                  <div class="tip showAlbumName">
	                                  	<!-- Show Album's Name -->
	                                  </div>
	                                  <div class="hr"></div>
	                                  <ul class="uibutton-group">
	                                    <input type="submit" class="uibutton save_form normal loading"  title="Saving" rel="1" value="save" />
	                                  </ul>
	                                  <div class="hr"></div>
                                  </form> <!-- End form -->
                                  <div class="deletezone small" > Drop Images To Delete</div>
                                  <div class="hr"></div>    
                         
                                  <div class="clear"></div>
                              </div> <!-- End .album_edit -->
                              
                              <div class="boxtitle" ><span class="texttip">double click to viwe large images // </span>
	                              <span class="tip showEdit"></span> or 
	                              <span class="tip showDelete"></span>
                              </div> <!-- End .boxtitle -->		


                              <div class="albumpics"> <!-- show list images here -->
                                    <ul id="sortable">
                                    	
										<!-- <li class="albumImage" >
                                            <div class="picHolder">
                                                <span class="image_highlight"></span>
                                                <a href="public/admin/img/exampic/b/05.jpg" rel='glr'></a>	
                                                <img src="public/admin/img/exampic/05.jpg"    title="Drag Image to delete"/>
		                                        <div class="picTitle">DSC00252.jpg</div>
		                                        <ul class="dataImg">
		                                            <li>13</li>
		                                            <li>DSC00252.jpg</li>
		                                        </ul>  
                                        	</div>
                                        </li>
                                         -->
                                    </ul> <!-- End #sortable -->
                              </div> <!-- End .albumpics -->
                        </div> <!-- End .albumImagePreview -->
                        
                        <div class="clear"></div>
                        </div> <!-- End .content -->
                        </div> <!-- End #onecolumn -->
                        <script type="text/javascript">
                        
                        var do_action_success 		= '<?php echo $this->session->userdata('delete_gallery');?>';
                      	var do_action_mess			= 'Delete Album Successfully !';
                      	if(do_action_success == "yes"){$('#alertMessage').addClass('success').html(do_action_mess).stop(true,true).show().animate({ opacity: 1,right: '10'}, 1000);setTimeout('hideTop()',1500);<?php $this->session->unset_userdata('delete_gallery');?>}

                      	var remove_album	=	'<?php echo $this->session->userdata('no-empty');?>';
                      	var remove_album_mes=	'Album removing is incompleted !';
                      	if(remove_album == "no"){$('#alertMessage').addClass('error').html(remove_album_mes).stop(true,true).show().animate({ opacity: 1,right: '10'}, 1000);setTimeout('hideTop()',1500);<?php $this->session->unset_userdata('no-empty');?>}

                      	var edit_album = '<?php echo $this->session->userdata('edit-success'); ?>';
                      	var mess	   = 'Edit Album successfully!';
                      	if(edit_album == "yes"){$('#alertMessage').addClass('success').html(mess).stop(true,true).show().animate({ opacity: 1,right: '10'}, 1000);setTimeout('hideTop()',1500);<?php $this->session->unset_userdata('edit-success');?>}
                        
	                        $(".albumDelete").live('click',function() {
	                 		   var albumid	=	$(this).attr('id');
	                 		   var dataSet=$(this).parents('form');
	                 		   var name = $(this).attr("name");
	                 		   var data ='id='+ $(this).attr("id");
	                 		   var url = admin_url+"delete-gallery/"+albumid; 
	                 		   albumDelete(data,name,dataSet,url);
	                 		});

	                        function albumDelete(data,name,dataSet,url){
	              			  var loadpage = dataSet.hdata(0);
	              			  var row = dataSet.hdata(2);
	              			  $.confirm({
	              			  'title': '_DELETE DIALOG BOX','message': "<strong>YOU WANT TO DELETE </strong><br /><font color=red>' "+ name +" ' </font> ",'buttons': {'Yes': {'class': 'special',
	              			  'action': function(){
	              						  loading('Checking',1);
	              						  window.location = url;
	              				}},'No'	: {'class'	: ''}}});
	              	  		}
                        </script>
   
                                           